﻿@model sample.Models.PagedList<sample.Models.tbd_News>

@{
    ViewBag.Title = "PagedList";
}
@using sample.Models;

<h2>PagedList</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Name
        </th>
        <th>
            Tag
        </th>
        <th>
            Image
        </th>
        <th>
            Content
        </th>
       
        <th>
            Date
        </th>
        <th>
            Title
        </th>
        <th>
            Description
        </th>
        <th>
            Keyword
        </th>
        <th>
            Priority
        </th>
        <th>
            Index
        </th>
        <th>
            Active
        </th>
        <th>
            GroupNewsId
        </th>
        <th>
            Lang
        </th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
            @Html.ActionLink("Details", "Details", new { id = item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.Id })
        </td>
        <td>
            @item.Name
        </td>
        <td>
            @item.Tag
        </td>
        <td>
            @item.Image
        </td>
        <td>
            @item.Content
        </td>
       
        <td>
            @String.Format("{0:g}", item.Date)
        </td>
        <td>
            @item.Title
        </td>
        <td>
            @item.Description
        </td>
        <td>
            @item.Keyword
        </td>
        <td>
            @item.Priority
        </td>
        <td>
            @item.Index
        </td>
        <td>
            @item.Active
        </td>
        <td>
            @item.GroupNewsId
        </td>
        <td>
            @item.Lang
        </td>
    </tr>
}

</table>

<div>
    Trang @(Model.TotalPageCount < Model.CurrentPageIndex ? 0 : Model.CurrentPageIndex)
    trong @Model.TotalPageCount
@*     
    @if (Model.)
    {
       
        @Html.ActionLink("<<", "PagedList", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
        @Html.Raw(" ");
        @Html.ActionLink("< Trioc", "PagedList", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
    }
    else
    {
        @:<<
        @Html.Raw(" ");
        @:< Prev
    }
 @if (Model.HasNextPage)
 {
        @Html.ActionLink("Sau >", "PagedList", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
        @Html.Raw(" ");
        @Html.ActionLink(">>", "PagedList", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
 }
 else
 {
        @:Next >
        @Html.Raw(" ")
        @:>>
    }*@
  </div>
@*@Html.Pager(Model,new PagerOptions{PageIndexParameterName="Id"})*@